home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / NANOTECH.ZIP / TIMER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-11  |  1.3 KB  |  56 lines

  1. /*
  2.  
  3. NanoTech - a 3d game engine
  4. Copyright (C) 1996  Sean Lane Fuller
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. Sean Lane Fuller
  21. 124 Autumn Lane
  22. Tullahoma, TN 37388
  23. 615-393-4550
  24. email: fuller@edge.net
  25.  
  26. */
  27.  
  28. #include "timer.h"
  29. #include <i86.h>
  30. #include <dos.h>
  31. #include <conio.h>
  32.  
  33. #define TIMER_INT 0x1c
  34.  
  35. void (_interrupt * Old_Timer_Isr)();
  36.  
  37. int clock_tick = 0;
  38. int timer_tick = 0;
  39.  
  40. void _interrupt New_Timer_Int(void)
  41. {
  42.    clock_tick++;
  43.    timer_tick++;
  44.   _chain_intr(Old_Timer_Isr);
  45. }
  46.  
  47. void Init_Timer() {
  48.    clock_tick = timer_tick = 0;
  49.    Old_Timer_Isr = _dos_getvect(TIMER_INT);
  50.    _dos_setvect(TIMER_INT, New_Timer_Int);
  51. }
  52.  
  53. void Close_Timer() {
  54.    _dos_setvect(TIMER_INT, Old_Timer_Isr);
  55. }
  56.